import Phaser from "phaser";
import { QUIInput } from "../QUIInput";

export default class Test extends Phaser.Scene {
    constructor() {
        super("Test");
    }

    preload() {
        // 加载组件包
        // this.qGame.loadQPackage("Test", "/assets/QGame_测试.qgp");
    }

    create() {
        // const button = this.qGame.add.button({
        //     left: 100,
        //     top: 100,
        // });

        // const input = this.qGame.add.input({
        //     left: 200,
        //     top: 200,
        // });
        // if (input) {
        //     input.onInput = (str) => {
        //         console.log("输入内容", str);
        //     };
        // }

        const a = this.qGame.add.objectFromXML(
            `
            <quiview xmlns="http://www.w3.org/1999/xhtml" name="QUIView" id="CountLoop" class="" widthratio="0" heightratio="0"
    width="160" height="140" miniwidth="0" miniheight="0" left="0" top="0" borderwidth="0" bordercolor="#000000"
    background="#e5e5e5" alpha="1" alignx="left" aligny="top" gap="0" paddingtop="0" paddingbottom="0" paddingleft="0"
    paddingright="0" imageurl="">
    <quiverticallayout name="QUIVerticalLayout" id="vertical_221" class="" widthratio="0" heightratio="100" width="156"
        height="140" miniwidth="0" miniheight="0" left="2" top="2" borderwidth="0" bordercolor="#000000"
        background="#ffffff" alpha="0" alignx="left" aligny="top" gap="1" paddingtop="0" paddingbottom="0"
        paddingleft="0" paddingright="0" imageurl="">
        <quiview name="QUIView" id="title" class="" widthratio="100" heightratio="0" width="156" height="20"
            miniwidth="0" miniheight="0" left="0" top="0" borderwidth="0" bordercolor="#000000" background="#009688"
            alpha="1" alignx="left" aligny="top" gap="0" paddingtop="0" paddingbottom="0" paddingleft="0"
            paddingright="0" imageurl="">
            <quilabel name="QUILabel" id="label_341" class="" widthratio="0" heightratio="0" width="48" height="13"
                miniwidth="0" miniheight="0" left="5" top="1.9945011622490796" borderwidth="0" bordercolor="#000000"
                background="#000000" alpha="0" alignx="left" aligny="top" gap="0" paddingtop="0" paddingbottom="0"
                paddingleft="0" paddingright="0" imageurl="" text="计数循环" fontsize="12" fontcolor="#ffffff"
                fontfamily="Arial"></quilabel>
        </quiview>
        <quiview name="QUIView" id="view_331" class="" widthratio="100" heightratio="0" width="156" height="115"
            miniwidth="0" miniheight="0" left="0" top="21" borderwidth="0" bordercolor="#000000" background="#8c8c8c"
            alpha="1" alignx="left" aligny="top" gap="0" paddingtop="0" paddingbottom="0" paddingleft="0"
            paddingright="0" imageurl="">
            <quiview name="QUIView" id="out_1" class="out" widthratio="0" heightratio="0" width="10" height="10"
                miniwidth="0" miniheight="0" left="141" top="10" borderwidth="2" bordercolor="#000000"
                background="#ffffff" alpha="1" alignx="left" aligny="top" gap="0" paddingtop="0" paddingbottom="0"
                paddingleft="0" paddingright="0" imageurl=""></quiview>
            <quiview name="QUIView" id="input_1" class="input" widthratio="0" heightratio="0" width="10" height="10"
                miniwidth="0" miniheight="0" left="5" top="10" borderwidth="2" bordercolor="#000000"
                background="#ffffff" alpha="1" alignx="left" aligny="top" gap="0" paddingtop="0" paddingbottom="0"
                paddingleft="0" paddingright="0" imageurl=""></quiview>
            <quiview name="QUIView" id="input_2" class="input" widthratio="0" heightratio="0" width="10" height="10"
                miniwidth="0" miniheight="0" left="5" top="40" borderwidth="2" bordercolor="#c86400"
                background="#ffffff" alpha="1" alignx="left" aligny="top" gap="0" paddingtop="0" paddingbottom="0"
                paddingleft="0" paddingright="0" imageurl=""></quiview>
            <quilabel name="QUILabel" id="label_731" class="" widthratio="0" heightratio="0" width="24" height="13"
                miniwidth="0" miniheight="0" left="18.13197114183086" top="7.038491864256457" borderwidth="0"
                bordercolor="#000000" background="#000000" alpha="0" alignx="left" aligny="top" gap="0" paddingtop="0"
                paddingbottom="0" paddingleft="0" paddingright="0" imageurl="" text="执行" fontsize="12"
                fontcolor="#ffffff" fontfamily="Arial"></quilabel>
            <quilabel name="QUILabel" id="label_731" class="" widthratio="0" heightratio="0" width="36" height="13"
                miniwidth="0" miniheight="0" left="101.13197114183086" top="7.038491864256457" borderwidth="0"
                bordercolor="#000000" background="#000000" alpha="0" alignx="left" aligny="top" gap="0" paddingtop="0"
                paddingbottom="0" paddingleft="0" paddingright="0" imageurl="" text="循环体" fontsize="12"
                fontcolor="#ffffff" fontfamily="Arial"></quilabel>
            <quiinput name="QUIInput" id="input_sindex" class="" widthratio="0" heightratio="0" width="40" height="20"
                miniwidth="0" miniheight="0" left="46.19325256347656" top="34.18766984989186" borderwidth="1"
                bordercolor="#1980f5" background="#eeeeee" alpha="1" alignx="left" aligny="top" gap="0" paddingtop="0"
                paddingbottom="0" paddingleft="0" paddingright="0" imageurl="" text="0" fontsize="10"
                fontcolor="#000000" fontfamily="Arial" placeholder="值" inputtype="number"></quiinput>
            <quilabel name="QUILabel" id="label_731" class="" widthratio="0" heightratio="0" width="24" height="13"
                miniwidth="0" miniheight="0" left="18.13197114183086" top="37.03849186425646" borderwidth="0"
                bordercolor="#000000" background="#000000" alpha="0" alignx="left" aligny="top" gap="0" paddingtop="0"
                paddingbottom="0" paddingleft="0" paddingright="0" imageurl="" text="开始" fontsize="12"
                fontcolor="#ffffff" fontfamily="Arial"></quilabel>
            <quilabel name="QUILabel" id="label_731" class="" widthratio="0" heightratio="0" width="24" height="13"
                miniwidth="0" miniheight="0" left="18.13197114183086" top="68.03849186425646" borderwidth="0"
                bordercolor="#000000" background="#000000" alpha="0" alignx="left" aligny="top" gap="0" paddingtop="0"
                paddingbottom="0" paddingleft="0" paddingright="0" imageurl="" text="最后" fontsize="12"
                fontcolor="#ffffff" fontfamily="Arial"></quilabel>
            <quiview name="QUIView" id="input_3" class="input" widthratio="0" heightratio="0" width="10" height="10"
                miniwidth="0" miniheight="0" left="5" top="70" borderwidth="2" bordercolor="#c86400"
                background="#ffffff" alpha="1" alignx="left" aligny="top" gap="0" paddingtop="0" paddingbottom="0"
                paddingleft="0" paddingright="0" imageurl=""></quiview>
            <quiview name="QUIView" id="out_2" class="out" widthratio="0" heightratio="0" width="10" height="10"
                miniwidth="0" miniheight="0" left="141" top="40" borderwidth="2" bordercolor="#000000"
                background="#ffffff" alpha="1" alignx="left" aligny="top" gap="0" paddingtop="0" paddingbottom="0"
                paddingleft="0" paddingright="0" imageurl=""></quiview>
            <quiview name="QUIView" id="out_3" class="out" widthratio="0" heightratio="0" width="10" height="10"
                miniwidth="0" miniheight="0" left="141" top="70" borderwidth="2" bordercolor="#000000"
                background="#ffffff" alpha="1" alignx="left" aligny="top" gap="0" paddingtop="0" paddingbottom="0"
                paddingleft="0" paddingright="0" imageurl=""></quiview>
            <quilabel name="QUILabel" id="label_241" class="" widthratio="0" heightratio="0" width="24" height="13"
                miniwidth="0" miniheight="0" left="113.62487237169336" top="36.95647779079299" borderwidth="0"
                bordercolor="#000000" background="#000000" alpha="0" alignx="left" aligny="top" gap="0" paddingtop="0"
                paddingbottom="0" paddingleft="0" paddingright="0" imageurl="" text="索引" fontsize="12"
                fontcolor="#ffffff" fontfamily="Arial"></quilabel>
            <quilabel name="QUILabel" id="label_251" class="" widthratio="0" heightratio="0" width="24" height="13"
                miniwidth="0" miniheight="0" left="112.74715064844318" top="66.36269446456987" borderwidth="0"
                bordercolor="#000000" background="#000000" alpha="0" alignx="left" aligny="top" gap="0" paddingtop="0"
                paddingbottom="0" paddingleft="0" paddingright="0" imageurl="" text="完成" fontsize="12"
                fontcolor="#ffffff" fontfamily="Arial"></quilabel>
            <quiview name="QUIView" id="input_4" class="input" widthratio="0" heightratio="0" width="10" height="10"
                miniwidth="0" miniheight="0" left="5" top="97" borderwidth="2" bordercolor="#000000"
                background="#ffffff" alpha="1" alignx="left" aligny="top" gap="0" paddingtop="0" paddingbottom="0"
                paddingleft="0" paddingright="0" imageurl=""></quiview>
            <quilabel name="QUILabel" id="label_731" class="" widthratio="0" heightratio="0" width="48" height="13"
                miniwidth="0" miniheight="0" left="18.13197114183086" top="95.03849186425646" borderwidth="0"
                bordercolor="#000000" background="#000000" alpha="0" alignx="left" aligny="top" gap="0" paddingtop="0"
                paddingbottom="0" paddingleft="0" paddingright="0" imageurl="" text="跳出循环" fontsize="12"
                fontcolor="#ffffff" fontfamily="Arial"></quilabel>
        </quiview>
    </quiverticallayout>
</quiview>
`
        );

        //         if (a) {
        //             const b = a.findViewByID("input_111") as QUIInput;
        //             b.InputType = "password";
        //             console.log(b.Text)
        //         }

        // console.log(a?.convertToXML());
    }
}
